<?php /*
	
*/ ?>
<?php 
include("system/config.inc.php");

// IF admin is not logged in then it will redirect to the adminlogin page.
if(!isset($_SESSION['adminuserid']))
{
	header("location:adminlogin.php?msg=logfirst");
	die();
}

//DELETE record from database
if(isset($_REQUEST['a']) && trim($_REQUEST['a'])==3)
{
	if(isset($_REQUEST['intid']) && trim($_REQUEST['intid']!=""))
	{	// prid 
	
	$prid=0;
	if(isset($_REQUEST['gid']) && ($_REQUEST['gid'])!="")
	{
		$prid=$_REQUEST['gid'];
	}
		//$pid=$_REQUEST['prid'];
		$id1 =  $_REQUEST['intid'];
		$sql= "DELETE FROM tblprodgiftideas WHERE intid ='$id1'";
		$query1 = mysql_query($sql);
		header("location:listproduct.php?msg=del&prid=".$prid);
		die();
	}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome to Duntuk- admin module</title>
<link href="css/dunt.css" rel="stylesheet" type="text/css" />
</head>


<body onload="">
<!--<script language="JavaScript1.2">mmLoadMenus();</script>-->


<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" class="middlebackground">
  <tr>
    <td colspan="3" valign="top" align="center"><?php include(INC."top.inc.php");?></td>
  </tr>
  <tr>
    <td width="2%">&nbsp;</td>
    <td width="96%"><table width="50%" border="0" align="center" cellpadding="2" cellspacing="2" class="border">
      
      <tr bgcolor="#000000">
        <td colspan="3" align="center">&nbsp;</td>
        <td align="center"><a href="#" title="Click here to Go Back!" onclick="history.go(-1);" class="fntstyle">Go Back!</a></td>
      </tr>
      <tr class="tblbg3">
        <td height="22" align="center"><strong>Product No </strong></td>
        <td align="center"><strong>Product Name </strong></td>
        <td align="center"><strong>Image</strong></td>
        <td align="center"><strong>Remove</strong></td>
      </tr>
      <?php
	 	/**************************************
				PAGING CODE START
		**************************************/
			//$rowperpage=23;
			$tablename="tblproducts";
			$per_page_keywords= "";
			$per_page_sorts="";
			include("system/paging.inc.php");

		/**************************************
				PAGING CODE ENDING
		**************************************/
	
	if(isset($_REQUEST['prid']) && ($_REQUEST['prid'])!="")
	{
		$prid=$_REQUEST['prid'];
		//echo $prid; die();
		$sql = "select * from `tblprodgiftideas` where `intgiftideaid` ='$prid'";
		$result = $obj_db->select($sql);
		if(count($result)>0)
		{
		for($i=0;$i<count($result);$i++)
		 { 
			$id=$result[$i]['intprodid'];		
?>
      <tr class="<?php echo ($i%2==0)?"Hrnormal":"Hralter"; ?>" onmouseover="this.className='Hrhover';"  onmouseout="this.className='<?php echo ($i%2==0)?"Hrnormal":"Hralter"; ?>';">
        <td align="center"><?php echo $id;?></td>
        <?php
		
		$sql55="select * from tblproducts where intprodid='$id'";
		$resultpr = $obj_db->select($sql55);
		if(count($resultpr)>0)
		{
			for($p=0;$p<count($resultpr);$p++)
			{
?>
        <td align="center"><?php
			  $sql6="select * from tblproddesc where intid='$id'"; 
			  $resname = $obj_db->select($sql6);
			  if(count($resname)>0)
			  {
			  	for($pn=0;$pn<count($resname);$pn++)
				{
					echo $resname[$pn]['varprodname'];
					
				}
			  }	
			  ?></td>
        <td align="center"><img title="'<?php echo $resname[0]['varprodname'];?>'" src="../images/product/<?php echo $resultpr[$p]['intproddefaultimg'];?>"/></td>
        <?php }}?>
        <td align="center"><a title="Click here to Remove" href="listproduct.php?a=3&intid=<?php echo $result[$i]['intid']; ?>&gid=<?php echo $prid?>" onclick="return confirm('Are you sure to remove this record?');"><img src="images/delete.bmp" border="0"/></a></td>
      </tr>
      <?php }}}?>
      <tr>
        <td colspan="9" align="center"><?php
//pagindet_atbotttom_page($div_page_no,$page_no,$req_querystr,$total_db_rec,$row_per_page);
?></td>
      </tr>
    </table></td>
    <td width="2%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3" align="center"><?php include(INC."bottom.php");?></td>
  </tr>
</table>

</body>
</html>
